# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
#
# Contributors:
#
# Description:
# ARMv5 KEXT ABIv2 Function Like Makefile (FLM)
# Build an e32 KEXT (Kernel Extension)
# 
#

ifeq ($(TARGETTYPE),kext)
include $(FLMHOME)/e32abiv2defaults.mk


# What we need to build a Kernel Extension
# an import library isn't strictly required, apparently. So only try to
# generate one if the def file exists.
ifeq ($(NOEXPORTLIBRARY),)
ifneq ($(DEFFILE),)
IMPORTLIBRARYREQUIRED:=1
endif
endif

POSTLINKDEFFILE:=$(DEFFILE)
SUPPORT_FREEZE:=1

# Default Linker settings for this target type
LINKER_ENTRYPOINT_LIBDEP:=$(STATIC_RUNTIME_DIR)/eext.lib
LINKER_ENTRYPOINT_SETTING:=$(LINKER_ENTRYPOINT_PREFIX)$(ENTRYPOINT) $(LINKER_ENTRYPOINT_DECORATION)$(LINKER_SEPARATOR)$(call dblquote,$(STATIC_RUNTIME_DIR)/eext.lib$(LINKER_ENTRYPOINT_ADORNMENT))

LINKER_STUB_LIBRARY:=$(STATIC_RUNTIME_DIR)/edllstub.lib
STATIC_RUNTIME_LIB:=$(KERNEL_STATIC_RUNTIME_LIB)
RUNTIME_LIBS_LIST:=
CANIGNORENONCALLABLE:=1

# Kernel code builds as arm
ALWAYS_BUILD_AS_ARM:=1
CANHAVEEXPORTS:=1
POSTLINKTARGETTYPE:=KEXT
POSTLINKFILETYPE:=dll
DOPOSTLINK:=1

# No dedicated library for operator new/delete functions.
HAS_DEDICATED_OP_NEWDEL_LIB:=

# No exception support for kernel code?
EXCEPTIONS:=$(NO_EXCEPTIONS)


BASELIBS:=eext.lib


# Use the general EABI FLM 
# We are appending to CDEFS and SYSTEMINCLUDE but we don't want this to affect
# other invocations so we are going to save it on a stack
# and restore it afterwards
$(call vsave,CDEFS SYSTEMINCLUDE)
SYSTEMINCLUDE:=$(SYSTEMINCLUDE) $(EPOCROOT)/epoc32/include/nkern $(EPOCROOT)/epoc32/include/kernel/arm $(EPOCROOT)/epoc32/include/memmodel/epoc $(EPOCROOT)/epoc32/include/kernel  $(EPOCROOT)/epoc32/include/nkern/arm
CDEFS:=$(CDEFS) __DLL__ __KERNEL_MODE__
include $(FLMHOME)/e32abiv2.flm
$(call vrestore)

else
$(error $e32abiv2kext.flm called with wrong TARGETTYPE (should be 'kext' but is '$(TARGETTYPE)'))
endif

